import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'//类似于导入js依赖


axios.interceptors.request.use(
  config=>{//获取浏览器的jwt，并加到请求头中
    let jwt=localStorage.getItem("authorization");
    if(jwt){
      config.headers.authorization=jwt //相当于{heards:{"authorization":jwt}}
    }
    return config;
  }
)

Vue.prototype.$axios = axios//配置全局变量$axios 代表axios

Vue.use(ElementUI);


Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
